#include "Tools.h"

#define N_TABS 20

static char tabs[N_TABS] = {0};

void Pause(int nmillis)
{
    useconds_t nmicros = (useconds_t) nmillis * 1000;
    usleep(nmicros);
}
void Println(const char *cstr)
{
    printf("%s\n", cstr);
}

void TPrint(const char *cstr)
{
    printf("%s", tabs);
    Println(cstr);
}

void TInit(int num_tabs)
{
    if(num_tabs > N_TABS - 1)
        return;
    memset(tabs, '\t', num_tabs);
}

int Random(int min, int max)
{
    int range = max - min;
    if(range < 0)
        return min;
    return (rand() % range) + min + 1;  //Do not include either min or max
}

void TPrint_int(const char *cstr, int value)
{
    printf("%s%s%d\n", tabs, cstr, value);
}
